package com.excel2sql.chenjun.ui;

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.List;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

public class ResultWindow extends JFrame
{
	/**
	 *  serialVersionUID
	 */
	private static final long serialVersionUID = 3321287259544638784L;
	
	private JScrollPane jScrollPane;
	private JTextArea jTextArea;
	private String result;
	private List<String> headList;
	private List<List<String>> datas;
	
	public void  initWindow()
	{
		jTextArea = new MenuTextArea();
		jScrollPane = new JScrollPane(jTextArea);
		jScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
		jScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
		//jTextArea.setLineWrap(true);        //激活自动换行功能 
		//jTextArea.setWrapStyleWord(true);            // 激活断行不断字功能

		super.setTitle("sql生成结果");
		super.setBounds(280, 100, 1200, 800);
		this.add(jScrollPane);
		jTextArea.setText(result);
		this.setVisible(true);
		
		this.addWindowListener(new WindowAdapter()
		{
			public void windowClosing(WindowEvent e)
			{
				super.windowClosing(e);
				System.exit(0);
			}
		});
	}
	
	public void showWindow()
	{
		initWindow();
	}
	
	public static void main(String[] args)
	{
		ResultWindow resultWindow = new ResultWindow();
		resultWindow.showWindow();
	}

	public String getResult()
	{
		return result;
	}

	public void setResult(String result)
	{
		this.result = result;
	}

	public List<String> getHeadList()
	{
		return headList;
	}

	public void setHeadList(List<String> headList)
	{
		this.headList = headList;
	}

	public List<List<String>> getDatas()
	{
		return datas;
	}

	public void setDatas(List<List<String>> datas)
	{
		this.datas = datas;
	}
	
}
